package br.diego.tb.advancedtechniques;

public class MaxSum {
	
	public static int find_max_sum(Integer[] v)
    {
		int evenSum = 0;
		int oddsSum = 0;
		
		for(int i = 0; i < v.length; i ++)
		{
			if(isIndexEven(i))
				evenSum += v[i];
			else
				oddsSum += v[i];
		}
		
		int maxSum = (evenSum > oddsSum) ? evenSum : oddsSum;
		
		System.out.println(maxSum);
		return maxSum;
    }
	
	private static boolean isIndexEven(int index)
	{
		boolean isEven = (index % 2 == 0);
		
		return isEven;
	}

}
